/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import javax.swing.JOptionPane;

/**
 *
 * @author Mufase
 */
public class MenuPrincipal extends javax.swing.JFrame {

    /**
     * Creates new form MenuPrincipal
     */
    public MenuPrincipal() {
        initComponents();
        this.setLocationRelativeTo(null);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jmnIngresarCamion = new javax.swing.JMenu();
        mnuIngresarRuta = new javax.swing.JMenuItem();
        mnuRegistrarCamion = new javax.swing.JMenuItem();
        mnuRegistrarCarga = new javax.swing.JMenuItem();
        mnuRegistrarPersonal = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        mnuSalir = new javax.swing.JMenuItem();
        mnConsultas = new javax.swing.JMenu();

        jRadioButtonMenuItem1.setSelected(true);
        jRadioButtonMenuItem1.setText("jRadioButtonMenuItem1");

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Registro de Rutas");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setBorder(javax.swing.BorderFactory.createCompoundBorder());

        jmnIngresarCamion.setText("Registros");

        mnuIngresarRuta.setText("Ingresar Ruta");
        mnuIngresarRuta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuIngresarRutaActionPerformed(evt);
            }
        });
        jmnIngresarCamion.add(mnuIngresarRuta);

        mnuRegistrarCamion.setText("Registro Camion");
        mnuRegistrarCamion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuRegistrarCamionActionPerformed(evt);
            }
        });
        jmnIngresarCamion.add(mnuRegistrarCamion);

        mnuRegistrarCarga.setText("Registro Carga");
        mnuRegistrarCarga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuRegistrarCargaActionPerformed(evt);
            }
        });
        jmnIngresarCamion.add(mnuRegistrarCarga);

        mnuRegistrarPersonal.setText("Registro Personal");
        mnuRegistrarPersonal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuRegistrarPersonalActionPerformed(evt);
            }
        });
        jmnIngresarCamion.add(mnuRegistrarPersonal);
        jmnIngresarCamion.add(jSeparator1);

        mnuSalir.setText("Salir");
        mnuSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSalirActionPerformed(evt);
            }
        });
        jmnIngresarCamion.add(mnuSalir);

        jMenuBar1.add(jmnIngresarCamion);

        mnConsultas.setText("Consultas");
        jMenuBar1.add(mnConsultas);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuRegistrarCamionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuRegistrarCamionActionPerformed
        RegistroCamiones p=new RegistroCamiones(this, true);
        p.setVisible(true);
    }//GEN-LAST:event_mnuRegistrarCamionActionPerformed

    private void mnuRegistrarCargaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuRegistrarCargaActionPerformed
         RegistroCarga p=new RegistroCarga(this, true);
         p.setVisible(true);
    }//GEN-LAST:event_mnuRegistrarCargaActionPerformed

    private void mnuRegistrarPersonalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuRegistrarPersonalActionPerformed
        RegistroPersonal p=new RegistroPersonal(this, true);
        p.setVisible(true);
    }//GEN-LAST:event_mnuRegistrarPersonalActionPerformed

    private void mnuIngresarRutaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuIngresarRutaActionPerformed
         IngresoRuta p=new IngresoRuta(this, true);
         p.setVisible(true);
    }//GEN-LAST:event_mnuIngresarRutaActionPerformed

    private void mnuSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSalirActionPerformed
         int opcion = 0;
        opcion = JOptionPane.showConfirmDialog(this, "¿Desea salir de la aplicacion?", "Salir de Aplicacion",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (opcion == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
    }//GEN-LAST:event_mnuSalirActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
       int opcion = 0;
        opcion = JOptionPane.showConfirmDialog(this, "¿Desea salir de la aplicacion?", "Salir de Aplicacion",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (opcion == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
    }//GEN-LAST:event_formWindowClosing

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MenuPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MenuPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JMenu jmnIngresarCamion;
    private javax.swing.JMenu mnConsultas;
    private javax.swing.JMenuItem mnuIngresarRuta;
    private javax.swing.JMenuItem mnuRegistrarCamion;
    private javax.swing.JMenuItem mnuRegistrarCarga;
    private javax.swing.JMenuItem mnuRegistrarPersonal;
    private javax.swing.JMenuItem mnuSalir;
    // End of variables declaration//GEN-END:variables
}
